﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Helpers;
using FluentAssertions;

namespace Helpers.Tests
{
    [TestClass]
    public class StringHelperTest
    {
        [TestMethod]
        public void Times_ReturnsEmptyString_IfNumberOfTimesIsZero()
        {
            // Arrange
            var str = "";

            // Act
            var concStr = str.Times(0);

            // Assert
            concStr.Should().BeEmpty();
        }

        [TestMethod]
        public void Times_ReturnsTheCalledString_IfNumberOfTimesIsOne()
        {
            // Arrange
            var str = "a";

            // Act
            var concStr = str.Times(1);

            // Assert
            concStr.Should().Be(str);
        }

        [TestMethod]
        public void Times_ReturnsTheCalledStringMultiplied_IfNumberOfTimesIsMoreThanOne()
        {
            // Arrange
            var str = "a";

            // Act
            var concStr = str.Times(10);

            // Assert
            concStr.Should().Be("aaaaaaaaaa");
        }

        [TestMethod]
        public void Times_ReturnsEmptyString_IfCalledOnNull()
        {
            // Arrange
            string str = null;

            // Act
            var concStr = str.Times(1);

            // Assert
            concStr.Should().BeEmpty();
        }

        [TestMethod]
        public void Times_ReturnsEmptyString_IfCalledOnNullWithAnyNumberOfTimesValue()
        {
            // Arrange
            string str = null;

            // Act
            var concStr = str.Times(10);

            // Assert
            concStr.Should().BeEmpty();
        }
    }
}
